package com.powerrich.webmagic.Pipeline;

import com.powerrich.webmagic.service.CreditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

import java.util.Map;

@Component
public class CreditPipeline implements Pipeline {
    @Autowired
    public CreditService creditService;


    @Override
    public void process(ResultItems resultItems, Task task) {
        System.out.println("ResultItems**************************************************");

/*        for (Map.Entry<String, Object> entry : resultItems.getAll().entrySet()) {
            if (entry.getKey().equals("music")) {
                Music music = (Music) entry.getValue();
                System.out.println("mMusicDao--->null" + mMusicDao == null);
                if (mMusicDao.countBySongId(music.getSongId()) == 0) {
                    mMusicDao.save(music);
                }
            } else {
                Comment comment = (Comment) entry.getValue();
                System.out.println("mCommentDao--->null" + mCommentDao == null);
                if (mCommentDao.countByCommentId(comment.getCommentId()) == 0) {
                    mCommentDao.save(comment);
                }
            }

        }*/
    }
}
